/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#pragma once

#include <OmenConfig.h>
#include <IOmenEventHandler.h>
#include <IOmenEvent.h>

#include "OmenEvents.h"

namespace Omen
{
    class OMEN_API EventHandler : public IEventHandler
    {
    public:
        virtual ~EventHandler();
        virtual void handleEvent(const Omen::Event*);

        template <class T, class EventT>
        void registerEventFunc(T* obj, void (T::*memFn)(EventT*)){
            _handlers[TypeInfo(typeid(EventT))]= new MemberFunctionHandler<T, EventT>(obj, memFn);
        }

    private:
        #pragma warning(disable:4251) // Disable warning about private member variable needs to have dll-interface to be used by clients of class 'this'
        typedef std::map<TypeInfo, HandlerFunctionBase*> Handlers;
        Handlers _handlers;
        #pragma warning(default:4251)
    };
} // namespace Omen

/// EOF